package com.anyext.storage.asm;

import org.springframework.asm.AnnotationVisitor;
import org.springframework.asm.ClassWriter;
import org.springframework.asm.FieldVisitor;
import org.springframework.asm.Label;
import org.springframework.asm.MethodVisitor;
import org.springframework.asm.Opcodes;

public class UserMapperDump implements Opcodes {

	public static byte[] dump() throws Exception {

		ClassWriter cw = new ClassWriter(0);
		FieldVisitor fv;
		MethodVisitor mv;
		AnnotationVisitor av0;

		cw.visit(V1_6, ACC_PUBLIC + ACC_SUPER, "com/anyext/storage/asm/UserMapper", "Ljava/lang/Object;Lcom/anyext/storage/jdbc/RowMapper<Lcom/anyext/storage/model/UserInfo;>;", "java/lang/Object", new String[] { "com/anyext/storage/jdbc/RowMapper" });

		cw.visitSource("UserMapper.java", null);

		{
			mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
			mv.visitCode();
			Label l0 = new Label();
			mv.visitLabel(l0);
			mv.visitLineNumber(9, l0);
			mv.visitVarInsn(ALOAD, 0);
			mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
			mv.visitInsn(RETURN);
			Label l1 = new Label();
			mv.visitLabel(l1);
			mv.visitLocalVariable("this", "Lcom/anyext/storage/asm/UserMapper;", null, l0, l1, 0);
			mv.visitMaxs(1, 1);
			mv.visitEnd();
		}
		{
			mv = cw.visitMethod(ACC_PUBLIC, "mapRow", "(Ljava/sql/ResultSet;I)Lcom/anyext/storage/model/UserInfo;", null, new String[] { "java/sql/SQLException" });
			mv.visitCode();
			Label l0 = new Label();
			mv.visitLabel(l0);
			mv.visitLineNumber(13, l0);
			mv.visitTypeInsn(NEW, "com/anyext/storage/model/UserInfo");
			mv.visitInsn(DUP);
			mv.visitMethodInsn(INVOKESPECIAL, "com/anyext/storage/model/UserInfo", "<init>", "()V");
			mv.visitVarInsn(ASTORE, 3);
			Label l1 = new Label();
			mv.visitLabel(l1);
			mv.visitLineNumber(14, l1);
			mv.visitVarInsn(ALOAD, 3);
			mv.visitVarInsn(ALOAD, 1);
			mv.visitLdcInsn("platUsername");
			mv.visitMethodInsn(INVOKEINTERFACE, "java/sql/ResultSet", "getString", "(Ljava/lang/String;)Ljava/lang/String;");
			mv.visitMethodInsn(INVOKEVIRTUAL, "com/anyext/storage/model/UserInfo", "setPlatUsername", "(Ljava/lang/String;)V");
			Label l2 = new Label();
			mv.visitLabel(l2);
			mv.visitLineNumber(15, l2);
			mv.visitVarInsn(ALOAD, 3);
			mv.visitVarInsn(ALOAD, 1);
			mv.visitLdcInsn("registerTime");
			mv.visitMethodInsn(INVOKEINTERFACE, "java/sql/ResultSet", "getDate", "(Ljava/lang/String;)Ljava/sql/Date;");
			mv.visitMethodInsn(INVOKEVIRTUAL, "com/anyext/storage/model/UserInfo", "setRegisterTime", "(Ljava/util/Date;)V");
			Label l3 = new Label();
			mv.visitLabel(l3);
			mv.visitLineNumber(16, l3);
			mv.visitVarInsn(ALOAD, 3);
			mv.visitInsn(ARETURN);
			Label l4 = new Label();
			mv.visitLabel(l4);
			mv.visitLocalVariable("this", "Lcom/anyext/storage/asm/UserMapper;", null, l0, l4, 0);
			mv.visitLocalVariable("rs", "Ljava/sql/ResultSet;", null, l0, l4, 1);
			mv.visitLocalVariable("rowNum", "I", null, l0, l4, 2);
			mv.visitLocalVariable("userInfo", "Lcom/anyext/storage/model/UserInfo;", null, l1, l4, 3);
			mv.visitMaxs(3, 4);
			mv.visitEnd();
		}
		{
			mv = cw.visitMethod(ACC_PUBLIC + ACC_BRIDGE + ACC_SYNTHETIC, "mapRow", "(Ljava/sql/ResultSet;I)Ljava/lang/Object;", null, new String[] { "java/sql/SQLException" });
			mv.visitCode();
			Label l0 = new Label();
			mv.visitLabel(l0);
			mv.visitLineNumber(1, l0);
			mv.visitVarInsn(ALOAD, 0);
			mv.visitVarInsn(ALOAD, 1);
			mv.visitVarInsn(ILOAD, 2);
			mv.visitMethodInsn(INVOKEVIRTUAL, "com/anyext/storage/asm/UserMapper", "mapRow", "(Ljava/sql/ResultSet;I)Lcom/anyext/storage/model/UserInfo;");
			mv.visitInsn(ARETURN);
			mv.visitMaxs(3, 3);
			mv.visitEnd();
		}
		cw.visitEnd();

		return cw.toByteArray();
	}
}
